package com.example.controller;

import com.example.entity.CustomReport;
import com.example.service.CustomReportService;
import com.example.service.JgCustomCountService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 自定义数据界面
 */
@RestController
@RequestMapping("api/customReport")
public class CustomReportController {
    // 引用监管场所自定义查询service
    @Autowired
    public CustomReportService customReportService;

    /**
     * 查询所有数据
     * @param
     * @param
     * @return
     */
    @ApiOperation(value = "查询自定义界面的所有数据",notes = "获取列表信息")
    @RequestMapping(value="findList",method = RequestMethod.POST)
    private Map<String,Object> findList(@RequestBody CustomReport customReport) {
        Map<String,Object> resultMap = customReportService.findList(customReport);
        return resultMap;
    }

    /**
     * 新增数据
     */
    @ApiOperation(value = "新增自定义界面的所有数据",notes = "获取列表信息")
    @RequestMapping(value="insert",method = RequestMethod.POST)
    private Map<String,Object> insert(@RequestBody CustomReport customReport) {
        Map<String,Object> resultMap = customReportService.insert(customReport);
        return resultMap;
    }

    /**
     * 批量删除数据
     */
    @ApiOperation(value = "自定义界面的批量删除",notes = "删除信息")
    @RequestMapping(value="delete",method = RequestMethod.POST)
    private Map<String,Object> delete(@RequestBody Map<String, Object> map) {
        List<String> ids = (List<String>)map.get("ids");
        Map<String,Object> resultMap = customReportService.delete(ids);
        return resultMap;
    }

    /**
     * 修改数据
     */
    @ApiOperation(value = "自定义界面的修改",notes = "修改信息")
    @RequestMapping(value="update",method = RequestMethod.POST)
    private Map<String,Object> update(@RequestBody CustomReport customReport) {
        Map<String,Object> resultMap = customReportService.update(customReport);
        return resultMap;
    }

}
